<template>
	<view id='order-detail'>
		<u-form label-position="left" class="demo-table-expand" label-width="150px" size="mini">
			<u-form-item label="单号:">{{obj.number}}</u-form-item>
			<u-form-item label="子单:" v-if="obj.sonList && obj.sonList.length > 0">
				<div v-for="item in obj.sonList" :key="item.id" style="display: flex; justify-content: space-between">
					<span>单号：{{item.number}}</span>
					<span>长：{{item.length}}</span>
					<span>宽：{{item.width}}</span>
					<span>高：{{item.height}}</span>
					<span>打包方式：{{item.packWay}}</span>
				</div>
			</u-form-item>
			<u-form-item label="寄件人姓名:">{{obj.senderName}}</u-form-item>
			<u-form-item label=" ">{{obj.laosSenderName}}</u-form-item>
			<u-form-item label="始发地:">{{obj.beginPlace}}</u-form-item>
			<u-form-item label=" ">{{obj.laosBeginPlace}}</u-form-item>
			<u-form-item label="单位名称:">{{obj.senderCompanyName}}</u-form-item>
			<u-form-item label=" ">{{obj.laosSenderCompanyName}}</u-form-item>
			<u-form-item label="寄件人详细地址:">{{obj.senderAddress}}</u-form-item>
			<u-form-item label=" ">{{obj.laosSenderAddress}}</u-form-item>
			<u-form-item label="寄件人联系电话:">{{obj.senderPhone}}</u-form-item>
			<u-form-item label="寄件人证件号:">{{obj.senderId}}</u-form-item>

			<u-divider half-width="100%">-</u-divider>

			<u-form-item label="收件人姓名:">{{obj.receiverName}}</u-form-item>
			<u-form-item label=" ">{{obj.laosReceiverName}}</u-form-item>
			<u-form-item label="目的地:">{{obj.endPlace}}</u-form-item>
			<u-form-item label=" ">{{obj.laosEndPlace}}</u-form-item>
			<u-form-item label="单位名称:">{{obj.receiverCompanyName}}</u-form-item>
			<u-form-item label=" ">{{obj.laosReceiverCompanyName}}</u-form-item>
			<u-form-item label="收件人详细地址:">{{obj.receiverAddress}}</u-form-item>
			<u-form-item label=" ">{{obj.laosReceiverAddress}}</u-form-item>
			<u-form-item label="收件人联系电话:">{{obj.receiverPhone}}</u-form-item>
			<u-form-item label="收件人证件号:">{{obj.receiverId}}</u-form-item>

			<u-divider half-width="100%">-</u-divider>

			<u-form-item label="快递种类:">{{obj.expressSort ? '文件' : '物品'}}</u-form-item>
			<u-form-item label="结算方式:">{{obj.websiteClearingWay ? '到付' : '寄付'}}</u-form-item>
			<u-form-item label="是否保价:">{{obj.isProtect ? '是' : '否'}}</u-form-item>
			<u-form-item label="保价类型:" v-if="obj.isProtect">{{obj.protectWay ? '易碎品' : '普通'}}</u-form-item>
			<u-form-item label="保额:" v-if="obj.isProtect">{{obj.coverage}}</u-form-item>
			<u-form-item label="保价费:" v-if="obj.isProtect">{{obj.protectFee}}</u-form-item>
			<u-form-item label="是否需要报关费:">{{obj.isCustomsFee ? '是' : '否'}}</u-form-item>
			<u-form-item label="报关费金额:" v-if="obj.isCustomsFee">{{obj.customsFee}}</u-form-item>
			<u-form-item label="重量:">{{obj.weight}}</u-form-item>
			<u-form-item label="运费:">{{obj.freight}}</u-form-item>
			<u-form-item label="代收贷款:">{{obj.loans}}</u-form-item>
			<u-form-item label="特殊区域费:">{{obj.specialPlaceFee}}</u-form-item>
			<u-form-item label="包装费:">{{obj.packFee}}</u-form-item>
			<u-form-item label="总计:">{{obj.totalFee}}</u-form-item>

			<u-divider half-width="100%">-</u-divider>

			<u-form-item label="品名(中文):">{{obj.articleName}}</u-form-item>
			<u-form-item label="品名(老挝):">{{obj.laosArticleName}}</u-form-item>
			<u-form-item label="品名(英文):">{{obj.enArticleName}}</u-form-item>
			<u-form-item label="税号">{{obj.dutyParagraph}}</u-form-item>
			<u-form-item label="规格型号:">{{obj.specification}}</u-form-item>
			<u-form-item label="毛重KG:">{{obj.roughWeight}}</u-form-item>
			<u-form-item label="净重KG:">{{obj.netWeight}}</u-form-item>
			<u-form-item label="内件毛重KG:">{{obj.insideRoughWeight}}</u-form-item>
			<u-form-item label="内件数量:">{{obj.insideCount}}</u-form-item>
			<u-form-item label="申报单价:">{{obj.declarationUnitFee}}</u-form-item>
			<u-form-item label="申报总价:">{{obj.declarationTotalFee}}</u-form-item>
			<u-form-item label="计量单位">{{obj.measureUnit}}</u-form-item>
			<u-form-item label="税率:">{{obj.taxRate}}</u-form-item>
			<u-form-item label="应收税额:">{{obj.receivableTax}}</u-form-item>
			<u-form-item label="实收税额:">{{obj.realTax}}</u-form-item>
			<u-form-item label="补收税额:">{{obj.repairTax}}</u-form-item>
			<u-form-item label="发件人城市:">{{obj.senderCity}}</u-form-item>
			<u-form-item label="英文发件人城市:">{{obj.enSenderCity}}</u-form-item>
			<u-form-item label="英文发件人:">{{obj.enSenderName}}</u-form-item>
			<u-form-item label="英文发件人地址:">{{obj.enSenderAddress}}</u-form-item>
			<u-form-item label="收件人城市:">{{obj.receiverCity}}</u-form-item>
			<u-form-item label="产销城市:">{{obj.saleCity}}</u-form-item>
			<u-form-item label="发件人国别(地区):">{{obj.senderCountry}}</u-form-item>
			<u-form-item label="备注(内件明细):">{{obj.detailNotes}}</u-form-item>

			<u-divider half-width="100%">-</u-divider>

			<u-form-item label="揽收网点:">{{operationFirst.currentUserName}}</u-form-item>
			<u-form-item label=" ">{{operationFirst.laosCurrentName}}</u-form-item>
			<u-form-item label="签收网点:">{{operationFirst.sendToName}}</u-form-item>
			<u-form-item label=" ">{{operationFirst.laosSendToName}}</u-form-item>
			<u-form-item label="状态:">{{$state(obj.state)}}</u-form-item>
			<u-form-item label="备注:">{{obj.notes}}</u-form-item>
			<u-form-item label=" ">{{obj.laosNotes}}</u-form-item>
			<u-form-item label="当前网点:">{{operationLast.currentName}}</u-form-item>
			<u-form-item label=" ">{{operationLast.laosCurrentName}}</u-form-item>
			<u-form-item label="发往网点:" v-if="operationLast.state === 1">{{operationLast.sendToName}}</u-form-item>
			<u-form-item label=" " v-if="operationLast.state === 1">{{operationLast.laosSendToName}}</u-form-item>
		</u-form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				obj: {
					sonList: []
				},
				operationFirst: {},
				operationLast: {}
			}
		},
		onLoad(e) {
			this.getObj(e.id)
			this.getData(e.number)
		},
		methods: {
			getObj(id) {
				if (!id) return
				this.$api.getExpressOrderApi({
					id: id
				}).then(result => {
					this.obj = result.resultParam.expressOrder
				})
			},
			getData(number) {
				if (!number) return
				this.$api.getOperationApi({
					number: number
				}).then(result => {
					let response = result.resultParam.result.begin;
					this.operationFirst = response[0] // 第一条物流信息
					this.operationLast = response[response.length - 1] // 最后第一条物流信息
				})
			}
		}
	}
</script>

<style lang="scss">
	#order-detail {
		padding: 10rpx;

		.u-form-item {
			padding: 0;
			border-bottom: 1rpx solid gray;
		}
	}
</style>
